﻿import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"
import "qrc:/qmlComponents/AxisModulePos"
import "qrc:/qmlComponents/VisionViewer"
import "qrc:/qmlComponents/CustomizedUIElement/RowColumnSelectorView"
import "qrc:/qmlComponents/CustomizedUIElement"

Item {

    ColumnLayout{

        XYZModulePos{
            moduleName: "SUTXYZ"
            posName: "ULPrGripPos"
        }

        MyTabView{
           indent: 3

           Component{
               id: calPickLensPos
               Item{
                   ColumnLayout{
                       XYZModulePos{
                           moduleName: "SUTXYZ"
                           posName: "DLPrLutPos"
                       }

                       Button{
                           text: qsTr("CalculatePickLensPos")
                           onClicked: {
                               tem.runSingleCmd(aaHead, "CalGripperPos", [1])
                           }
                       }

                       XYZModulePos{
                           moduleName: "SUTXYZ"
                           posName: "PickLensPos"
                       }
                    }
                  }
            }

           Component{
                id: calPlaceRLens
                Item {
                    ColumnLayout{
                        XYZModulePos{
                            moduleName: "SUTXYZ"
                            posName: "DLPrRLutPos"
                        }

                        Button{
                            text: qsTr("CalculateRejectLensPos")
                            onClicked: {
                                tem.runSingleCmd(aaHead, "CalGripperPos", [2])
                            }
                        }

                        XYZModulePos{
                            moduleName: "SUTXYZ"
                            posName: "RejectLensPos"
                        }

                        Button{
                            text: qsTr("PlaceRejectLens")
                            onClicked: {
                                tem.runSingleCmd(aaHead, "placeRejectLensManual")
                            }
                        }
                     }
                }
           }

           Component{
               id: calMushroomPos
               Item {
                   ColumnLayout{
                       XYZModulePos{
                           moduleName: "SUTXYZ"
                           posName: "DLPrSutPos"
                       }

                       Button{
                           text: qsTr("CalculateMushroomPos")
                           onClicked: {
                               tem.runSingleCmd(aaHead, "CalGripperPos", [3])
                           }
                       }

                       XYZModulePos{
                           moduleName: "SUTXYZ"
                           posName: "MushroomPos"
                       }
                    }
               }

           }


           Component.onCompleted: {
               addTab("Cal_Pick_lens", calPickLensPos)
               addTab("Cal_Mushroom_Pos", calMushroomPos)
               addTab("Cal_PlaceReject_Lens", calPlaceRLens)
           }
        }
    }
}

